package com.info.zhiduoduo.alipay.constant;

import com.info.zhiduoduo.common.constants.EnumFindHelper;

/**
 * 支付宝接口支持的银行卡类型
 */
public enum AlipayBankAccountEnum {

	PERSONAL(1, "对私"),
	CORPORATE(2, "对公"),
	;

	public int id;
	public String name;

	AlipayBankAccountEnum(int id, String name) {
		this.id = id;
		this.name = name;
	}

	//####################################### 方便查找枚举值的方法 ###################################//

	static final EnumFindHelper<AlipayBankAccountEnum, Integer> IdHelper = new EnumFindHelper<>(AlipayBankAccountEnum.class, e -> e.id);

	static final EnumFindHelper<AlipayBankAccountEnum, String> NameHelper = new EnumFindHelper<>(AlipayBankAccountEnum.class, e -> e.name);

	public static AlipayBankAccountEnum findById(int id) {
		return IdHelper.find(id, PERSONAL);
	}

	public static AlipayBankAccountEnum findByName(String name) {
		return NameHelper.find(name, PERSONAL);
	}
}
